﻿#region

using Framework.Text.SerializerProvider;

#endregion

namespace Framework.Text
{
    /// <summary>
    ///   序列化 器 工厂类
    /// </summary>
    public static class SerializerProviderFactory
    {
        /// <summary>
        ///   获取 序列化器
        /// </summary>
        /// <param name = "serializer"></param>
        /// <typeparam name = "T"></typeparam>
        /// <returns></returns>
        public static ISerializer<T> GetSerializerProvider<T>(Serializer serializer)
        {
            switch (serializer)
            {
                case Serializer.XML:
                    return new XmlSerializerProvider<T>();
                case Serializer.JSON:
                    return new JSONSerializerProvider<T>();
                case Serializer.CSV:
                    return new CSVSerializerProvider<T>();
                case Serializer.Binary:
                    return new BinarySerializerProvider<T>();
                case Serializer.JSV:
                    return new JSVSerializerProvider<T>();
                case Serializer.KeyValue:
                    return new KeyValueSerializerProvider<T>();

                default:
                    return new XmlSerializerProvider<T>();
            }
        }
    }
}